using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;using Maxleaf.EDI.Domain.K3;

namespace Maxleaf.EDI.DataAccess.K3
{
    public class PPBOMEntryMap : EntityTypeConfiguration<PPBOMEntry>
    {
        public PPBOMEntryMap()
        {
            // Primary Key
            this.HasKey(t => new { t.FInterID, t.FEntryID });

            // Properties
            this.Property(t => t.FBrNo)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.FInterID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FEntryID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FBatchNo)
                .HasMaxLength(200);

            this.Property(t => t.FMachinePos)
                .HasMaxLength(1000);

            this.Property(t => t.FSequenceID)
                .HasMaxLength(30);

            this.Property(t => t.FNote)
                .HasMaxLength(255);

            this.Property(t => t.FPositionNo)
                .IsRequired()
                .HasMaxLength(255);

            this.Property(t => t.FItemSize)
                .IsRequired()
                .HasMaxLength(255);

            this.Property(t => t.FItemSuite)
                .IsRequired()
                .HasMaxLength(255);

            this.Property(t => t.FNote1)
                .IsRequired()
                .HasMaxLength(255);

            this.Property(t => t.FNote2)
                .IsRequired()
                .HasMaxLength(255);

            this.Property(t => t.FNote3)
                .IsRequired()
                .HasMaxLength(255);

            this.Property(t => t.FMTONo)
                .IsRequired()
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("PPBOMEntry");
            this.Property(t => t.FBrNo).HasColumnName("FBrNo");
            this.Property(t => t.FInterID).HasColumnName("FInterID");
            this.Property(t => t.FEntryID).HasColumnName("FEntryID");
            this.Property(t => t.FItemID).HasColumnName("FItemID");
            this.Property(t => t.FBatchNo).HasColumnName("FBatchNo");
            this.Property(t => t.FUnitID).HasColumnName("FUnitID");
            this.Property(t => t.FQtyMust).HasColumnName("FQtyMust");
            this.Property(t => t.FAuxQtyMust).HasColumnName("FAuxQtyMust");
            this.Property(t => t.FQty).HasColumnName("FQty");
            this.Property(t => t.FAuxQty).HasColumnName("FAuxQty");
            this.Property(t => t.FMachinePos).HasColumnName("FMachinePos");
            this.Property(t => t.FSequenceID).HasColumnName("FSequenceID");
            this.Property(t => t.FStockID).HasColumnName("FStockID");
            this.Property(t => t.FNote).HasColumnName("FNote");
            this.Property(t => t.FSourceEntryID).HasColumnName("FSourceEntryID");
            this.Property(t => t.FQtyScrap).HasColumnName("FQtyScrap");
            this.Property(t => t.FAuxQtyScrap).HasColumnName("FAuxQtyScrap");
            this.Property(t => t.FScrap).HasColumnName("FScrap");
            this.Property(t => t.FSendItemDate).HasColumnName("FSendItemDate");
            this.Property(t => t.FQtyPick).HasColumnName("FQtyPick");
            this.Property(t => t.FAuxQtyPick).HasColumnName("FAuxQtyPick");
            this.Property(t => t.FSPID).HasColumnName("FSPID");
            this.Property(t => t.FMaterielType).HasColumnName("FMaterielType");
            this.Property(t => t.FOperID).HasColumnName("FOperID");
            this.Property(t => t.FBackFlush).HasColumnName("FBackFlush");
            this.Property(t => t.FMarshalType).HasColumnName("FMarshalType");
            this.Property(t => t.FStockType).HasColumnName("FStockType");
            this.Property(t => t.FQtyBackFlush).HasColumnName("FQtyBackFlush");
            this.Property(t => t.FStockQty).HasColumnName("FStockQty");
            this.Property(t => t.FAuxStockQty).HasColumnName("FAuxStockQty");
            this.Property(t => t.FAuxQtyLoss).HasColumnName("FAuxQtyLoss");
            this.Property(t => t.FQtyLoss).HasColumnName("FQtyLoss");
            this.Property(t => t.FBOMInPutQTY).HasColumnName("FBOMInPutQTY");
            this.Property(t => t.FWIPQTY).HasColumnName("FWIPQTY");
            this.Property(t => t.FWIPAuxQTY).HasColumnName("FWIPAuxQTY");
            this.Property(t => t.FLockFlag).HasColumnName("FLockFlag");
            this.Property(t => t.FSelDiscardQty).HasColumnName("FSelDiscardQty");
            this.Property(t => t.FSelDiscardAuxQty).HasColumnName("FSelDiscardAuxQty");
            this.Property(t => t.FDiscardQty).HasColumnName("FDiscardQty");
            this.Property(t => t.FDiscardAuxQty).HasColumnName("FDiscardAuxQty");
            this.Property(t => t.FBomInputAuxQty).HasColumnName("FBomInputAuxQty");
            this.Property(t => t.FICItemReplaceID).HasColumnName("FICItemReplaceID");
            this.Property(t => t.FQtySupply).HasColumnName("FQtySupply");
            this.Property(t => t.FAuxQtySupply).HasColumnName("FAuxQtySupply");
            this.Property(t => t.FOperSN).HasColumnName("FOperSN");
            this.Property(t => t.FBomInterID).HasColumnName("FBomInterID");
            this.Property(t => t.FSelTransLateAuxQty).HasColumnName("FSelTransLateAuxQty");
            this.Property(t => t.FSelTransLateQty).HasColumnName("FSelTransLateQty");
            this.Property(t => t.FTransLateAuxQty).HasColumnName("FTransLateAuxQty");
            this.Property(t => t.FTransLateQty).HasColumnName("FTransLateQty");
            this.Property(t => t.FICMOInterID).HasColumnName("FICMOInterID");
            this.Property(t => t.FChangeTimes).HasColumnName("FChangeTimes");
            this.Property(t => t.FPositionNo).HasColumnName("FPositionNo");
            this.Property(t => t.FItemSize).HasColumnName("FItemSize");
            this.Property(t => t.FItemSuite).HasColumnName("FItemSuite");
            this.Property(t => t.FNote1).HasColumnName("FNote1");
            this.Property(t => t.FNote2).HasColumnName("FNote2");
            this.Property(t => t.FNote3).HasColumnName("FNote3");
            this.Property(t => t.FPlanMode).HasColumnName("FPlanMode");
            this.Property(t => t.FMTONo).HasColumnName("FMTONo");
        }
    }
}
